<?php

namespace App\Http\Controllers;

use App\Models\Activity;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Input;

class ActivityController extends BaseController
{
    //
    public function index()
    {
        $input = Input::all();
        if(isset($input) && $input['location'] >0 ) {
            $list = Activity::select('id','pic','sort','url','view_status','title')
                ->where('location', $input['location'])
                ->where('status',0)
                ->orderby('sort', 'asc')->get();
            foreach ($list as $k=>$v) {
                $v->pic = $this->http_url.'/uploads/'.$v->pic;
            }

            return $this->success('成功', ['list'=>$list]);
        }else{

            return $this->error('参数location错误');
        }
    }

}
